
<!DOCTYPE html>
<html lang="en" class="loading">
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>2.Python程序no.1 - fubaisen</title>
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="google" content="notranslate" />
    <meta name="keywords" content="Fechin,"> 
    <meta name="description" content="mkdir 创建目录 touch创建文件
No.1 Python程序
1.1python源程序的基本概念

python源程序是一个  特殊格式的文本文件，可以使用任意文本编辑软件做Python的开,"> 
    <meta name="author" content="John Doe"> 
    <link rel="alternative" href="atom.xml" title="fubaisen" type="application/atom+xml"> 
    <link rel="icon" href="/img/favicon.png"> 
    
    
    
    <meta name="twitter:card" content="summary"/>
    <meta name="twitter:title" content="2.Python程序no.1 - fubaisen"/>
    <meta name="twitter:description" content="mkdir 创建目录 touch创建文件
No.1 Python程序
1.1python源程序的基本概念

python源程序是一个  特殊格式的文本文件，可以使用任意文本编辑软件做Python的开,"/>
    
    
    
    
    <meta property="og:site_name" content="fubaisen"/>
    <meta property="og:type" content="object"/>
    <meta property="og:title" content="2.Python程序no.1 - fubaisen"/>
    <meta property="og:description" content="mkdir 创建目录 touch创建文件
No.1 Python程序
1.1python源程序的基本概念

python源程序是一个  特殊格式的文本文件，可以使用任意文本编辑软件做Python的开,"/>
    
<link rel="stylesheet" href="/css/diaspora.css">

    <script>window.searchDbPath = "/search.xml";</script>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Source+Code+Pro&display=swap" rel="stylesheet">
<meta name="generator" content="Hexo 6.3.0"></head>

<body class="loading">
    <span id="config-title" style="display:none">fubaisen</span>
    <div id="loader"></div>
    <div id="single">
    <div id="top" style="display: block;">
    <div class="bar" style="width: 0;"></div>
    <a class="iconfont icon-home image-icon" href="javascript:;" data-url="http://fubaisen.github.io"></a>
    <div title="播放/暂停" class="iconfont icon-play"></div>
    <h3 class="subtitle">2.Python程序no.1</h3>
    <div class="social">
        <div>
            <div class="share">
                <a title="获取二维码" class="iconfont icon-scan" href="javascript:;"></a>
            </div>
            <div id="qr"></div>
        </div>
    </div>
    <div class="scrollbar"></div>
</div>

    <div class="section">
        <div class="article">
    <div class='main'>
        <h1 class="title">2.Python程序no.1</h1>
        <div class="stuff">
            <span>十二月 22, 2021</span>
            
  <ul class="post-tags-list" itemprop="keywords"><li class="post-tags-list-item"><a class="post-tags-list-link" href="/tags/python%E5%AD%A6%E4%B9%A0/" rel="tag">python学习</a></li></ul>


        </div>
        <div class="content markdown">
            <p><code>mkdir 创建目录</code> <code>touch创建文件</code></p>
<p>No.1 Python程序</p>
<p>1.1python源程序的基本概念</p>
<ol>
<li>python源程序是一个  特殊格式的文本文件，可以使用任意文本编辑软件做Python的开发</li>
<li>python程序的文件扩展名通常是  .py</li>
</ol>
<p>1.2演练步骤</p>
<ul>
<li>在桌面新建 认识python  目录</li>
<li>在 <code>认识python</code>目录下新建<code>01-HelloPython.py</code> 文件</li>
<li>使用gedit编辑<code>01-HelloPython.py</code> 并且输入以下内容</li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">print(&quot;hello,python&quot;)</span><br><span class="line">print(&quot;hello,world&quot;)</span><br></pre></td></tr></table></figure>

<ul>
<li>在终端输入以下命令执行<code>01-HelloPython.py</code></li>
</ul>
<figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">python 01-HelloPython.py</span><br></pre></td></tr></table></figure>

<blockquote>
<p>print是python中我们学习的第一个函数</p>
<p>print函数的作用，可以把””内部的内容，输出到屏幕上</p>
</blockquote>
<p>1.3演练扩展——认识错误（bug）</p>
<p>关于错误</p>
<ul>
<li>编写的程序不能正常执行，或者执行的结果不是期望的</li>
<li>所称bug是程序员在开发时非常常见的，初学者常见的错误原因包括：<ul>
<li>手误</li>
<li>对已经学习过的知识理解还存在不足</li>
<li>对语言还有需要学习和提升的内容</li>
</ul>
</li>
<li>在学习语言时，不经要学会语言的语法，而且还要学会如何认识错误和解决错误的方法</li>
</ul>
<p>第一个程序演练中的常见错误</p>
<ul>
<li><p>使用print(“Hello world”)</p>
<p><img src="https://s2.loli.net/2023/03/15/MrbmFsUeL7qtHdQ.png" alt="image-20211209165337617"></p>
</li>
<li><p>将多条print写在一行</p>
<p><img src="https://s2.loli.net/2023/03/15/MKo5baL3zSX6EIG.png" alt="image-20211209165436920">每行代码负责完成一个动作</p>
</li>
<li><p>缩进错误</p>
<p><img src="https://s2.loli.net/2023/03/15/1RZPMivbKlSB7L8.png" alt="image-20211209165809159"></p>
<p><img src="https://s2.loli.net/2023/03/15/yuQFKBRlNL1nvz9.png" alt="image-20211209165728804"></p>
</li>
</ul>
<blockquote>
<ul>
<li>python是一个格式非常严格的程序设计语言</li>
<li>目前而言，每行代码前面不要增加空格</li>
</ul>
</blockquote>
<ul>
<li>python 2.×牧人不支持中文</li>
</ul>
<p>目前市场上有两个python的版本并存着，分别是python 2.×和python 3.×</p>
<ul>
<li>python 2.×的解释器器名称时python<ul>
<li>不支持中文</li>
<li><img src="https://s2.loli.net/2023/03/15/2Wt891LobKem4xu.png" alt="image-20211209170622255"></li>
</ul>
</li>
<li>python 3.×的解释器器名称时python3<ul>
<li>支持中文</li>
<li><img src="https://s2.loli.net/2023/03/15/Tvs5R4JVeBWKOp2.png" alt="image-20211209170649832"></li>
</ul>
</li>
</ul>
<p><img src="https://s2.loli.net/2023/03/15/9ER1uyBKJM7ia5P.png" alt="image-20211209170235446"></p>
<blockquote>
<p>ASCII字符只包含256个字符不支持中文</p>
</blockquote>
<p><img src="https://s2.loli.net/2023/03/15/tMPhbkmFJRTjWLC.png" alt="image-20211209170716948"></p>

            <!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->
            <audio id="audio" loop="1" preload="auto" controls="controls" data-autoplay="false">
                <source type="audio/mpeg" src="">
            </audio>
            
                <ul id="audio-list" style="display:none">
                    
                        
                            <li title="0" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                        
                            <li title="1" data-url="http://link.hhtjim.com/163/425570952.mp3"></li>
                        
                    
                </ul>
            
        </div>
        
        
    <div id="gitalk-container" class="comment link"
		data-enable="false"
        data-ae="false"
        data-ci=""
        data-cs=""
        data-r=""
        data-o=""
        data-a=""
        data-d="false"
    >查看评论</div>


    </div>
    
</div>


    </div>
</div>
</body>


<script src="//lib.baomitu.com/jquery/1.8.3/jquery.min.js"></script>
<script src="/js/plugin.js"></script>
<script src="/js/typed.js"></script>
<script src="/js/diaspora.js"></script>


<link rel="stylesheet" href="/photoswipe/photoswipe.css">
<link rel="stylesheet" href="/photoswipe/default-skin/default-skin.css">


<script src="/photoswipe/photoswipe.min.js"></script>
<script src="/photoswipe/photoswipe-ui-default.min.js"></script>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">
    <!-- Background of PhotoSwipe. 
         It's a separate element as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>
    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">
        <!-- Container that holds slides. 
            PhotoSwipe keeps only 3 of them in the DOM to save memory.
            Don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>
        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">
            <div class="pswp__top-bar">
                <!--  Controls are self-explanatory. Order can be changed. -->
                <div class="pswp__counter"></div>
                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>
                <button class="pswp__button pswp__button--share" title="Share"></button>
                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>
                <button class="pswp__button pswp__button--zoom" title="Zoom in/out"></button>
                <!-- Preloader demo http://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                      <div class="pswp__preloader__cut">
                        <div class="pswp__preloader__donut"></div>
                      </div>
                    </div>
                </div>
            </div>
            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div> 
            </div>
            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>
            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>
            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>
        </div>
    </div>
</div>






</html>
